package net.sourceforge.peertwitter.mbpast.messaging;

import java.util.concurrent.atomic.AtomicInteger;

import rice.p2p.commonapi.Id;
import rice.p2p.commonapi.NodeHandle;

public class ReplicaRequest extends MBPastMessageTemplate {

	private static final long serialVersionUID = -4525804819201266733L;
	private final Id requestedProfile;
	private volatile AtomicInteger idGen = new AtomicInteger(0);
	private final int uniqueId;

	public Id getProfileId() {
		return requestedProfile;
	}

	public ReplicaRequest(NodeHandle sender, Id profileId) {
		super(sender);
		this.requestedProfile = profileId;
		this.uniqueId = idGen.getAndIncrement();
	}

	
	@Override
	public String toString() {
		return "ReplicaRequest [sender=" + getSender() + ", requestedProfile="
				+ requestedProfile + "]";
	}

	@Override
	public int getPriority() {
		return HIGH_PRIORITY;
	}

	public int getUniqueId() {
		return uniqueId;
	}

}
